package com.walterweimod.auxiliary_attributes.capability.impl.base;

import com.walterweimod.auxiliary_attributes.capability.IAttributeValue;
import net.minecraft.world.entity.ai.attributes.Attribute;

import java.util.Map;

public abstract class ChargeLivingEntityAttributeRangedValueBase<T extends Comparable<T>>
        extends ChargeLivingEntityRangedValueBase<T> implements IAttributeValue {
    private Map<String, Attribute> attributeMap;

    @Override
    public Map<String, Attribute> getAttributeMap() {
        return attributeMap;
    }

    @Override
    public void setAttributeMap(Map<String, Attribute> attributeMap) {
        this.attributeMap = attributeMap;
    }

    public abstract void updateMinMaxDefaultValue();

    @Override
    public T getValue() {
        updateMinMaxDefaultValue();

        return super.getValue();
    }

    @Override
    public void setValue(T value) {
        updateMinMaxDefaultValue();

        super.setValue(value);
    }

    @Override
    public T getMaxValue() {
        updateMinMaxDefaultValue();

        return super.getMaxValue();
    }

    @Override
    public T getMinValue() {
        updateMinMaxDefaultValue();

        return super.getMinValue();
    }

    @Override
    public void resetValue() {
        updateMinMaxDefaultValue();

        super.resetValue();
    }

    @Override
    public T getDefaultValue() {
        updateMinMaxDefaultValue();

        return super.getDefaultValue();
    }

    @Override
    public T getAndSetValue(T value) {
        updateMinMaxDefaultValue();

        return super.getAndSetValue(value);
    }

    @Override
    public T getAndResetValue() {
        updateMinMaxDefaultValue();

        return super.getAndResetValue();
    }
}
